package com.pzr.soccer.handler;

import com.pzr.soccer.model.R;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author pzr
 * @date:2022-01-05-11:18
 * @Description:
 **/
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(UsernameNotFoundException.class)
    @ResponseBody
    public R<Object> handleUsernameNotFoundException(UsernameNotFoundException unf){

         return R.fail(unf.getMessage());
    }
}
